package com.chuangmei.com.arindoorlocationsystem.video;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.VideoView;

import com.chuangmei.com.arindoorlocationsystem.utils.AppActivityManagerUtils;

/**
 * 项目名称：ARIndoorLocationSystem
 * 类描述：全屏播放视频
 * 创建人：LuoHao
 * 创建时间：2018/4/16 16:10
 * 修改人：LuoHao
 * 修改时间：2018/4/16 16:10
 * 修改备注：
 */

public class FullScreenVideoView extends VideoView {

    private Context context;

    public FullScreenVideoView(Context context) {
        super(context);
        this.context = context;
    }

    public FullScreenVideoView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    public FullScreenVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        int width = getDefaultSize(0, widthMeasureSpec);//得到默认的大小（0，宽度测量规范）
        int height = getDefaultSize(0, heightMeasureSpec + AppActivityManagerUtils.getInstance().getStatusBarHeight
                (context));
        //得到默认的大小（0，高度度测量规范）
        setMeasuredDimension(width, height); //设置测量尺寸,将高和宽放进去
    }
}
